<template>
  <a-upload
    :name="name"
    :accept="accept"
    :multiple="multiple"
    :action="action"
    :headers="headers"
    :showUploadList="showUploadList"
    :disabled="disabled"
    :beforeUpload="beforeUpload"
    :remove="remove"
    :defaultFileList="defaultFileList"
    @change="onChange"
  >
    <slot />
  </a-upload>
</template>

<script>
export default {
  name: 'DUpload',
  props: {
    name: {
      type: String
    },
    accept: {
      type: String
    },
    multiple: {
      type: Boolean,
      default: false
    },
    action: {
      type: String
    },
    headers: {
      type: Object
    },
    showUploadList: {
      type: Boolean,
      default: true
    },
    disabled: {
      type: Boolean,
      default: false
    },
    beforeUpload: {
      type: Function
    },
    remove: {
      type: Function
    },
    defaultFileList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    onChange(e) {
      this.$emit('change', e);
    }
  }
};
</script>

<style scoped lang="scss"></style>
